package com.xxyf.config.dataese;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.sql.Timestamp;
import java.util.Date;
import java.time.LocalDateTime;

/**
 * @Author 小小怡飞
 * @Date 2022/12/17 19:30
 * @Version JDK 8
 */
@Component
public class Mybatis_plus implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        this.setFieldValByName("gmtCreate", new Timestamp(System.currentTimeMillis()), metaObject);
        this.setFieldValByName("gmtModified", new Timestamp(System.currentTimeMillis()), metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        this.setFieldValByName("gmtModified", new Timestamp(System.currentTimeMillis()), metaObject);
    }
}
